package yelmor.comm100.domain;

import org.hibernate.annotations.Type;
import org.xml.sax.XMLReader;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.stream.XMLEventReader;

/**
 * Created by yel on 2016/5/5.
 */
@Entity
@Table(name = "ofMessageArchive")
public class OfMessageArchive {

  @Id
  private Long messageID;

  public void setMessageID(Long messageID) {
    this.messageID = messageID;
  }

  public Long getMessageID() {
    return messageID;
  }

  private Long conversationID;

  public void setConversationID(Long conversationID) {
    this.conversationID = conversationID;
  }

  public Long getConversationID() {
    return conversationID;
  }

  private String fromJID;

  public void setFromJID(String fromJID) {
    this.fromJID = fromJID;
  }

  public String getFromJID() {
    return fromJID;
  }

  private String fromJIDResource;

  public void setFromJIDResource(String fromJIDResource) {
    this.fromJIDResource = fromJIDResource;
  }

  public String getFromJIDResource() {
    return fromJIDResource;
  }

  private String toJID;

  public void setToJID(String toJID) {
    this.toJID = toJID;
  }

  public String getToJID() {
    return toJID;
  }

  private String toJIDResource;

  public void setToJIDResource(String toJIDResource) {
    this.toJIDResource = toJIDResource;
  }

  public String getToJIDResource() {
    return  toJIDResource;
  }

  private Long sentDate;

  public void setSentDate(Long sentDate) {
    this.sentDate = sentDate;
  }

  public Long getSentDate() {
    return sentDate;
  }

  @Type(type="text")
  private String stanza;

  public void setStanza(String stanza) {
    this.stanza = stanza;
  }

  public String getStanza() {
    return stanza;
  }

  @Type(type="text")
  private String body;

  public void setBody(String body) {
    this.body = body;
  }

  public String getBody() {
    return body;
  }

  public String toString() {
    String value = "message: ";
    if(body != null) {
      value += body;
    }
    if(fromJID != null) {
      value += fromJID;
    }
    return value;
  }
}
